<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
         //父类 基类
         function Person(naem,age){
            // 给实例对象用的
            this.naem=naem;
            this.age = age;
         }
         Person.prototype.eat=function(){
            console.log('我吃的快');
         }
         //子类
         function Student(sex,naem,age){
            //构造函数继承
          Person.call(this,naem,age)
          this.sex=sex
         }
         //原型链继承(不能直接把父类的原型对象赋值给子类的原型对象,否则会共享)
         Student.prototype= new Person;
         //修正constructor
         Student.prototype.constructor = Student;
        // 添加自己的方法
          Student.prototype.study=function(){
            console.log('123');
          }
    </script>
</body>
</html>